package com.simple.base.controller;


import com.simple.base.common.result.CommonResult;
import com.simple.base.common.utils.ResultUtils;
import com.simple.base.core.repository.entity.SysDept;
import com.simple.base.core.service.ISysDeptService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author kin
 * @since 2017-12-19
 */
@RestController
@RequestMapping("/api/sys/dept")
public class SysDeptController {

    @Autowired
    private ISysDeptService sysDeptService;

    @RequiresPermissions(value = "sys:dept:list")
    @RequestMapping(value = "list", method = RequestMethod.GET)
    public CommonResult list() {
        List<SysDept> deptList = sysDeptService.selectList(null);
        return ResultUtils.ok(deptList);
    }
}
